<?php
defined('_JEXEC') or die('Restricted access');

/**
 * This is a file to add template specific chrome to module rendering.  To use it you would
 * set the style attribute for the given module(s) include in your template to use the style
 * for each given modChrome function.
 *
 * eg.  To render a module mod_test in the sliders style, you would use the following include:
 * <jdoc:include type="module" name="test" style="slider" />
 *
 * This gives template designers ultimate control over how modules are rendered.
 *
 * NOTICE: All chrome wrapping methods should be named: modChrome_{STYLE} and take the same
 * three arguments.
 */


/**
 * Custom module chrome, echos the whole module in a <div> and the header in <h{x}>. The level of
 * the header can be configured through a 'headerLevel' attribute of the <jdoc:include /> tag.
 * Defaults to <h3> if none given
 */
function modChrome_semi_rounded($module, &$params, &$attribs)
{ ?>
		<div class="module<?php echo $params->get('moduleclass_sfx'); ?>">
			<div class="semi_rounded_top">
				<div>
					<div>
						<?php if ($module->showtitle != 0) : ?>
							<h3 class="sidebar_fixed"><?php echo $module->title; ?></h3>
						<?php endif; ?>
						<?php echo $module->content; ?>
					</div>
				</div>
			</div>
			<div class="semi_rounded_bottom"></div>
		</div>
	<?php
}

function modChrome_semi_rounded_accordion($module, &$params, &$attribs)
{ ?>
		<div class="module<?php echo $params->get('moduleclass_sfx'); ?>">
			<div class="semi_rounded_top">
				<div>
					<div>
						<?php if ($module->showtitle != 0) : ?>
							<h3 class="toggler"><?php echo $module->title; ?></h3>
						<?php endif; ?>
						<div class="toggle_area">
							<?php echo $module->content; ?>
						</div>
					</div>
				</div>
			</div>
			<div class="semi_rounded_bottom"></div>
		</div>
	<?php
}

function modChrome_menu($module, &$params, &$attribs)
{ ?>
		<div class="module<?php echo $params->get('moduleclass_sfx'); ?>">
			<?php if ($module->showtitle != 0) : ?>
				<h3><?php echo $module->title; ?></h3>
			<?php endif; ?>
			<?php echo $module->content; ?>
		</div>
	<?php
}

function modChrome_tr_flexwidth($module, &$params, &$attribs)
{ ?>
	<?php if (isset( $attribs['grid_width'] )) {
		$grid_width = 'modtile_' . $attribs['grid_width'];
    } else {
		$grid_width = 'modtile_1';
    } ?>
	<div class="module<?php echo $params->get('moduleclass_sfx') . ' ' . $grid_width; ?>">
		<div class="moduleTitle">
			<?php if ($module->showtitle != 0) : ?>
				<h3><?php echo $module->title; ?></h3>
			<?php endif; ?>
		</div>
		<div class="clearfix"></div>
		<div class="moduleContent">
			<?php echo $module->content; ?>
		</div>
	</div>
<?php
}

?>
